<?php

/**
 * Module_XMLConf_Load
 *This function returns an array with every datas stored in the conf.xml file of an application
 *@author  3dward
 *@param <string> $module  application folder name (user as an id)
 */
function Module_XMLConf_Load($module) {

	$datas = array();

	$path = './modules/'.$module.'/conf.xml';

    $xml = simplexml_load_file($path);
	$datas = Module_XMLConf_CreateArray($xml);


	if (empty($datas))
	{
		$datas = false;
	}
	
	return $datas;

}

/**
 * Module_XMLConf_CreateArray
 *This function moves every datas of the SimpleXMLObject from conf.xml to a flat array
 *@author : 3dward
 *@param <SimpleXMLObject> $xml created with simplexml_load_file
*/
function Module_XMLConf_CreateArray($xml) {

	$array = array();

	foreach ($xml->children() as $child)
	{
		foreach ($child->children() as $key => $data)
		{
			$array[$key] = $data;
		}
	}

	return $array;

}

?>